<?php if (!defined('THINK_PATH')) exit();?><!doctype html>
<html lang="zh-cn">
<head>
    <meta charset="UTF-8"/>
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=0"/>
    <title>订单详情</title>
    <link rel="stylesheet" type="text/css" href="/Public/vendor/font-awesome/css/font-awesome.css"/>
    <link rel="stylesheet" type="text/css" href="/Public/assets/home/css/common.css"/>
</head>
<body>

<ul class="menu">
    <li class="on"><a class="current" href="#">全部</a></li>
    <li><a href="#">待发货</a></li>
    <li><a href="#">已发货</a></li>
    <li><a href="#">已完成</a></li>
</ul>

<div class="order">
    <h2>订单号：000000001</h2>
    <h4 class="payment"><img src="/Public/assets/home/images/bg02.png" alt="待付款"></h4>
    <h4 class="deliver"><img src="/Public/assets/home/images/bg05.png" alt="待发货"></h4>
    <h4 class="send"><img src="/Public/assets/home/images/bg03.png" alt="已发货"></h4>
    <h4 class="finish"><img src="/Public/assets/home/images/bg02.png" alt="已完成"></h4>
    <dl>
        <dt><img class="img-responsive" src="http://oi6a6qhed.bkt.clouddn.com/5a0701e04c5c6.jpg" alt="产品图片"></dt>
        <dd>热干面</dd>
        <dd><span>x 2</span>¥ 4.00元</dd>
    </dl>

    <p>总价：<em>¥ 8.00元</em> <i class="cancel" data-id="{$order.id}" data-status="{$order.status}">取消订单</i></p>
</div>

<div class="order">
    <h2>订单号：000000002</h2>
    <h4 class="payment"><img src="/Public/assets/home/images/bg04.png" alt="待付款"></h4>
    <h4 class="deliver"><img src="/Public/assets/home/images/bg05.png" alt="待发货"></h4>
    <h4 class="send"><img src="/Public/assets/home/images/bg03.png" alt="已发货"></h4>
    <h4 class="finish"><img src="/Public/assets/home/images/bg02.png" alt="已完成"></h4>
    <dl>
        <dt><img class="img-responsive" src="http://oi6a6qhed.bkt.clouddn.com/5a07037901566.jpg" alt="产品图片"></dt>
        <dd>四季美汤包</dd>
        <dd><span>x 1</span>¥ 28.00元</dd>
    </dl>

    <p>总价：<em>¥ 28.00元</em> <i class="cancel" data-id="{$order.id}" data-status="{$order.status}">取消订单</i></p>
</div>

<div class="perspective">
    <span class="more">查看更多</span>
</div>

<div class="clearsH"></div>

<script type="text/javascript" src="/Public/assets/home/js/jquery.min.js"></script>
<script type="text/javascript" src="/Public/vendor/sticky/jquery.sticky.js"></script>
<script type="text/javascript" src="/Public/assets/home/js/order.js"></script>
<script type="text/javascript">
    $(function () {
        //取消订单
        $('.cancel').click(function () {
            var $self = $(this);
            if (confirm('确定要取消此订单么？')) {
                var id = $(this).attr('data-id');
                var status = $(this).attr('data-status');
                $.post("{:U('cancel_order')}", {
                    id: id,
                    status: status
                }, function (data) {
                    if (data.statuses = 1) {
                        alert('您已成功取消订单~');
                        $self.parents('.order').remove();
                    } else {
                        alert('取消订单失败~');
                    }
                }, 'json')
            }
        });

        //查看更多，鼠标滚动监听事件
        var winH = $(window).height(); //页面可视区域高度
        var i = 1; //设置当前页数
        $(window).scroll(function () {
            var pageH = $(document.body).height();
            var scrollT = $(window).scrollTop(); //滚动条top
            var aa = (pageH - winH - scrollT) / winH;
            if (aa < 0.02) {
                $.getJSON("{:U('Customer/getMore')}", {page: i}, function (json) {
                    if (json.length > 0) {
                        //console.log(json);
                        var str = "";
                        $.each(json, function (key, value) {
//                            var str = '<div class="order">'+
//                                    "<h2>订单号：'+ value.order_no +'</h2>"+
//
//                                    '<h4 class="payment">'+ value.status +'</h4>'+
//
//                                    "<dl>"+
//                                    '<dt><img class="img-responsive" src="/uploads/images/'+ value.thumb +'" alt="产品图片"></dt>'+
//                                    "<dd>'+ value.goods_name +'</dd>"+
//                                    "<dd><span>x '+ value.number +'</span>¥ '+ value.price +'</dd>"+
//                                    "</dl>"+
//
//                                    '<p>总价：<em>¥ '+ value.total_price +'</em> <i class="cancel">取消订单</i></p>'+
//                                    '</div>';
                            $(".order").append(str);
                        });
                        //i++;
                    } else {
                        $(".more").show().html("数据已加载完~");
                        return false;
                    }
                });
            }
        });
    })
</script>
</body>
</html>